package com.example.designpattern.responsibility;

import com.example.designpattern.responsibility.validator.LengthValidator;
import com.example.designpattern.responsibility.validator.NotNullValidator;
import com.example.designpattern.responsibility.validator.PriceValidator;
import com.example.designpattern.responsibility.validator.StockValidator;
import com.example.model.GoodsDTO;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author long
 * @date 2024/12/20 14:49
 */
//@Service
public class ParamValidatorChain {

    @Resource
    private IValidator firstValidator;

    public void startParamValidate(GoodsDTO dto){
        firstValidator.validate(dto);
    }

//    @Resource
//    private NotNullValidator firstValidator;
//
//    @Resource
//    private LengthValidator lengthValidator;
//
//    @Resource
//    private PriceValidator priceValidator;
//
//    @Resource
//    private StockValidator stockValidator;
//
//    @Override
//    public void afterPropertiesSet() throws Exception {
//        firstValidator.setNext(lengthValidator)
//                .setNext(priceValidator).setNext(stockValidator);
//    }

    // 实现Order接口，按照优先级顺序设置下一个节点

    // 在每一个节点加配置，做业务降级，可以动态的修改配置中心的值，动态修改是否需要判断


}
